#ifndef _NEPTUNER_RADAR_H
#define _NEPTUNER_RADAR_H

#include<vector>
#include<string>

#include <boost/filesystem/convenience.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>

namespace bfs = boost::filesystem;

class CodebaseUnit
{
public:
	enum Type
	{
		eCBUInvalid,
		eCBUDirectory,
		eCBUFile
	};

	std::string m_sName;
	std::string m_sExtension;
	std::string m_sLocation;
	Type		m_eType;
	int			m_nLevel;

	CodebaseUnit()
	{
		m_eType = eCBUInvalid;
		m_nLevel = 0;
	}
};

class Codebase
{
public:
	std::vector<CodebaseUnit*> m_apxUnit;
};


class Radar
{
public:
	bfs::path	m_xCodebaseRoot;
	bfs::path	m_xNeptunerRoot;
	bfs::path	m_xIncludeRoot;

	Codebase	m_xCodebase;
	Codebase	m_xIncludeFiles;
	std::vector<std::string>	m_asExclusions;
	std::vector<bfs::path>		m_axInclusions;
	bool		m_bCreate;

public:
	Radar ();
	int			scan(std::string sSourceDir, bool bRecurse = true, bool bCreate=false);
	void		include(std::string sIncludeDir);
	void		exclude(std::string sExcludeItem);
	std::string	getAbsolutePath(std::string sFilename);
	std::string getCodebaseLocation(bfs::path xDirEntryPath);
	void		dump();

private:
	int			createShadowDirFor(bfs::path xSourceDir);
	void		scanDirectory(const bfs::path& xPath, int nLevel=0, bool bRecurse=true);
	bool		isFileTypeSupported(std::string sExtension);
	bool		isInExcludeList(std::string sFilename);
};

#endif
